package com.fable.sp.core.domain;

import com.fable.sp.core.enums.ColumnType;
import com.google.common.collect.Lists;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

/**
 * .
 *
 * @author stormning on 16/8/29.
 */
public class PersistentField implements Serializable {
    public static final String FIELD_NAME_PREFIX = "persistent_field_";

    private Object value;
    private List<ColumnType> supportTypes = Lists.newArrayList();
    private String name;
    private int length = 0;
    private String display;

    public PersistentField() {
    }

    public PersistentField(ColumnType... supportTypes) {
        if (supportTypes != null) {
            Collections.addAll(this.supportTypes, supportTypes);
        }
    }

    public PersistentField setLength(int length) {
        this.length = length;
        return this;
    }

    public int getLength() {
        return length;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<ColumnType> getSupportTypes() {
        return supportTypes;
    }

    public void setSupportTypes(List<ColumnType> supportTypes) {
        this.supportTypes = supportTypes;
    }

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    public String getDisplay() {
        return display;
    }

    public void setDisplay(String display) {
        this.display = display;
    }
}
